package cn.edu.scau.cmi.linzhiyang.userInterface;

import java.util.ArrayList;
import cn.edu.scau.cmi.linzhiyang.singleton.Chairman;
import cn.edu.scau.cmi.linzhiyang.singleton.Marshal;
import javafx.fxml.FXML;

import javafx.scene.control.Button;

import javafx.scene.control.TextField;

public class SingletonController {
	@FXML
	private Button btn_1;
	@FXML
	private TextField text_1;
	@FXML
	private TextField text_2;
	@FXML
	private Button btn_2;

	public void eventButton() {
		String text = text_1.getText();
		Chairman chairman = Chairman.getInstance(text);
		System.out.println("当前国家主席为：" + chairman.getName());
	}

	public void eventButton2() {
		String text = text_2.getText();
		ArrayList<Marshal> marshal = Marshal.getInstance(text);
		for (int i = 0; i < marshal.size(); i++) {
			System.out.println("第" + (i + 1) + "个元帅为：" + marshal.get(i).getName());
		}
		System.out.println("\n");
	}
}